import request from '@/utils/request'

export function login(data) {
  return request({
    url: 'http://localhost:9000/hrm/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: 'http://localhost:9000/hrm/user/info',
    method: 'get',
    params: { token }
  })
}

export function getUserProfile(userId) {
  return request({
    url: 'http://localhost:9000/hrm/user/profile',
    method: 'get',
    params: { userId }
  })
}

export function getIndexPanel(userId) {
  return request({
    url: 'http://localhost:9000/hrm/user/index/panel',
    method: 'get',
    params: { userId }
  })
}

export function updatePassword(data) {
  return request({
    url: 'http://localhost:9000/hrm/user/updatePassword',
    method: 'post',
    data
  })
}

export function sendForgetVerify(email) {
  return request({
    url: 'http://localhost:9000/hrm/user/send/verify',
    method: 'get',
    params: { email }
  })
}

export function resetPassword(data) {
  return request({
    url: 'http://localhost:9000/hrm/user/reset/password',
    method: 'post',
    data
  })
}

export function updateProfile(data) {
  return request({
    url: 'http://localhost:9000/hrm/user/updateProfile',
    method: 'post',
    data
  })
}

export function editAddressInfo(data) {
  return request({
    url: 'http://localhost:9000/hrm/user/profile/edit/address',
    method: 'post',
    data
  })
}

export function editEducationInfo(data) {
  return request({
    url: 'http://localhost:9000/hrm/user/profile/edit/college',
    method: 'post',
    data
  })
}

export function getSalaryYearByUserId(userId) {
  return request({
    url: 'http://localhost:9000/hrm/sal/list/year',
    method: 'get',
    params: { userId }
  })
}

export function getSalaryMonthByUserId(userId) {
  return request({
    url: 'http://localhost:9000/hrm/sal/list/month',
    method: 'get',
    params: { userId }
  })
}

export function getSalaryList(data) {
  return request({
    url: 'http://localhost:9000/hrm/sal/list',
    method: 'post',
    data
  })
}

export function getInsuranceList(salaryId) {
  return request({
    url: 'http://localhost:9000/hrm/sal/list/insurance',
    method: 'get',
    params: { salaryId }
  })
}

export function getAllowanceList(salaryId) {
  return request({
    url: 'http://localhost:9000/hrm/sal/list/allowance',
    method: 'get',
    params: { salaryId }
  })
}

export function getChargeList(salaryId) {
  return request({
    url: 'http://localhost:9000/hrm/sal/list/charge',
    method: 'get',
    params: { salaryId }
  })
}

export function getSalaryListById(data) {
  return request({
    url: 'http://localhost:9000/hrm/sal/person/list',
    method: 'post',
    data
  })
}

export function logout(data) {
  return request({
    url: 'http://localhost:9000/hrm/user/logout',
    method: 'post',
    data
  })
}

